function Item() {
	this.x;
	this.y;
	this.setPosition = function(x,y){
		this.x = x;
		this.y = y;
	}
}

function Ball(){
	this.departure = new Item();
}
Ball.prototype = new Item();

function Map(){
	this.hole_distance = 0;
	this.tee = new Item();
	this.hole = new Item();
	
	this.target = new Item();
	this.ball = new Ball();
	
	var distance_per_px;
	
	function getDistancePX(item1, item2){
    	var dx = item1.x - item2.x;
    	var dy = item1.y - item2.y;

    	var distance = Math.sqrt(dx * dx + dy * dy);
    	return distance;
    }
	
	this.getDistance = function(item1,item2){
		return distance_per_px * getDistancePX(item1,item2);
	}
	
	this.setHoleDistance = function(hole_distance){
		this.hole_distance = hole_distance;
		distance_per_px = this.hole_distance/getDistancePX(this.tee, this.hole);
	}
	
	this.setTeePosition = function(x,y){
		this.tee = new Item();
		this.tee.setPosition(x,y);
		//distance_per_px = this.hole_distance/getDistancePX(this.tee, this.hole);
	}
	
	this.setHolePosition = function(x,y){
		this.hole = new Item();
		this.hole.setPosition(x,y);
		//distance_per_px = this.hole_distance/getDistancePX(this.tee, this.hole);
	}
	
	this.getTargetToBallDistance = function(){
		return this.getDistance(this.ball, this.target);
	}
	
	this.getBallShotDistance = function(){
		return this.getDistance(this.ball, this.ball.departure);
	}
}
